<?php
if (isset($_REQUEST["tal"])){
	$tal = $_REQUEST["tal"];
}
session_start();
if (!isset($_REQUEST["tal"])){
	session_destroy();
	session_start();
}
if (isset($_SESSION["total"])){
	$total = $_SESSION["total"];
	if (isset($_REQUEST["plus"])){
		$total = $total + $tal;
	}if (isset($_REQUEST["minus"])){
		$total = $total - $tal;
	}if (isset($_REQUEST["gange"])){
		$total = $total * $tal;
	}if (isset($_REQUEST["divider"])){
		$total = $total / $tal;
	}
}else{
	$total = 0;
}
echo "sum: $total";
$_SESSION["total"] = $total;
?>
<form action="sessionregner.php">
<input type="text" name="tal"/>
<input type="submit" name="plus" value="+"/>
<input type="submit" name="minus" value="-"/>
<input type="submit" name="gange" value="x"/>
<input type="submit" name="divider" value="/"/>
</form>